package trading.algo.APIConnectivityTask;

import java.util.TimerTask;

import trading.bo.IBAccessorBO;
import trading.util.IBMsgIDGen;

public class CancelHistoricalDataTask extends TimerTask {

    private IBAccessorBO ibAccessorBO;
    private int taskID;
    
    public CancelHistoricalDataTask(int taskID, IBAccessorBO ibAccessorBO) {
        this.ibAccessorBO = ibAccessorBO;
        this.taskID = taskID;
    }
    
    @Override
    public void run() {
        IBMsgIDGen ibMsgIDGen = this.ibAccessorBO.getIbMsgIDGen();
        ibMsgIDGen.releaseCurrentMsgBean();
        this.ibAccessorBO.cancelHistoricalData(taskID);
    }
    
    public static int secondsNeeded() {
        return 1;
    }

}
